/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Entity;

import java.io.Serializable;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;

/**
 *
 * @author A0077454
 */
@Entity
public class CustomerFinance extends Customer {
    private static final long serialVersionUID = 1L;
   
    private Double creditLimit;
    @OneToOne(cascade = {CascadeType.PERSIST})
    private PaymentTerm paymentTerm;
    private Double cashInAdvance;
    @OneToMany(cascade = {CascadeType.PERSIST}, mappedBy="customerFinance")
    private List<CustomerFinanceHistory> CFHistorys = new ArrayList(); 
    public CustomerFinance() {
    }

    
    public void create(String customerType, Double creditLimit,  Double cashInAdvance) {
         this.creditLimit = creditLimit;
         this.cashInAdvance = cashInAdvance;
    }

    public List<CustomerFinanceHistory> getCFHistorys() {
        return CFHistorys;
    }
    
    

    public void setCFHistorys(List<CustomerFinanceHistory> CFHistorys) {
        this.CFHistorys = CFHistorys;
    }

   
    
    public PaymentTerm getPaymentTerm() {
        return paymentTerm;
    }

    public void setPaymentTerm(PaymentTerm paymentTerm) {
        this.paymentTerm = paymentTerm;
    }
    
    public Double getCashInAdvance() {
        return cashInAdvance;
    }

    public void setCashInAdvance(Double cashInAdvance) {
        this.cashInAdvance = cashInAdvance;
    }

    public Double getCreditLimit() {
        return creditLimit;
    }

    public void setCreditLimit(Double creditLimit) {
        this.creditLimit = creditLimit;
    }
  
    
    //// THINN CHANGES /////
    public void addCFHIstorys(CustomerFinanceHistory cf)
    {
        this.CFHistorys.add(cf);
    }

}
